import java.io.File;

public class Demo1 {
    public static void main(String[] args) throws InterruptedException {
        File file = new File("Hello World.txt");
        //删除文件
        file.delete();
        //退出程序时删除文件
        file.deleteOnExit();
        Thread.sleep(5000);
        System.out.println(file.exists());
    }
}
